<!DOCTYPE html>

<!--[if IE 8]>
<html lang="en" class="ie8 no-js"> <![endif]-->
<!--[if IE 9]>
<html lang="en" class="ie9 no-js"> <![endif]-->
<!--[if !IE]><!-->
<html lang="en">
<!--<![endif]-->

<!-- Head BEGIN -->
<head>
    <meta charset="utf-8">
    <title><?php echo $this->obj->getValidateMessage('dingdanjiesuan'); ?></title>
    <?php echo $this->view->getPartial('layouts/_meta') ?>
</head>
<!-- Head END -->

<!-- Body BEGIN -->
<body class="ecommerce">

<?php echo $this->obj->view->getPartial('layouts/_header') ?>

<div class="main">
    <div class="container">
        <ul class="breadcrumb">
            <li><a href="/"><?php echo $this->obj->getValidateMessage('shouye'); ?></a></li>
            <li class="active"><?php echo $this->obj->getValidateMessage('dingdanjiesuan'); ?></li>
        </ul>
        <!-- BEGIN SIDEBAR & CONTENT -->
        <div class="row margin-bottom-40">
            <!-- BEGIN CONTENT -->
            <div class="col-md-12 col-sm-12">
                <!--<h1>结算</h1>-->
                <!-- BEGIN CHECKOUT PAGE -->
                <div class="panel-group checkout-page accordion scrollable" id="checkout-page">

                    <!-- BEGIN CONFIRM -->
                    <div id="confirm" class="panel panel-default">
                        <div id="confirm-content"
                             class="panel-collapse collapse in">
                            <div class="panel-body row">
                                <div class="col-md-12 clearfix">
                                    <div class="table-wrapper-responsive">
                                        <table>
                                            <tr>
                                                <th class="checkout-image"><?php echo $this->obj->getValidateMessage('tupian'); ?></th>
                                                <th class="checkout-description"><?php echo $this->obj->getValidateMessage('shangpinmingcheng'); ?></th>
                                                <th class="checkout-model"><?php echo $this->obj->getValidateMessage('yanse'); ?></th>
                                                <th class="checkout-model"><?php echo $this->obj->getValidateMessage('menu-2-1-7'); ?></th>
                                                <th class="checkout-quantity"><?php echo $this->obj->getValidateMessage('jiage'); ?></th>
                                                <th class="checkout-price"><?php echo $this->obj->getValidateMessage('shuliang'); ?></th>
                                                <th class="checkout-price"><?php echo $this->obj->getValidateMessage('zongjia'); ?></th>
                                            </tr>
                                            <?php foreach ($data['product'] as $k => $v) { ?>
                                                <tr>
                                                    <td class="checkout-image">
                                                        <a href="/product/detail/<?php echo $v['product_detail_id']; ?>"><img
                                                                    src="<?php echo \Asa\Erp\Util::getCorrentImgUrl($this->file_prex . $v['picture']); ?>"
                                                                    alt="<?php echo $v['product_name']; ?>"></a>
                                                    </td>
                                                    <td class="checkout-description">
                                                        <h3>
                                                            <a href="/product/detail/<?php echo $v['product_detail_id']; ?>"><?php echo $v['product_name']; ?></a>
                                                        </h3>
                                                    </td>
                                                    <td class="checkout-model"><?php echo $v['color_name']; ?></td>
                                                    <td class="checkout-model"><?php echo $v['size_name']; ?></td>
                                                    <td class="checkout-quantity"><?php echo $this->obj->currency . $v['price']; ?></td>
                                                    <td class="checkout-price">
                                                        <strong><?php echo $v['number']; ?></strong></td>
                                                    <td class="checkout-total">
                                                        <strong><span><?php echo $this->obj->currency; ?></span><?php echo $v['total_price']; ?>
                                                        </strong></td>
                                                </tr>
                                            <?php } ?>

                                        </table>
                                    </div>
                                    <div class="checkout-total-block">
                                        <ul>
                                            <li>
                                                <em><?php echo $this->obj->getValidateMessage('zongjia'); ?></em>
                                                <strong class="price"><span><?php echo $this->obj->currency; ?></span><?php echo $data['common']['total_price']; ?>
                                                </strong>
                                            </li>
                                            <li>
                                                <em><?php echo $this->obj->getValidateMessage('freight'); ?></em>
                                                <strong class="price"><span><?php echo $this->obj->currency; ?></span><?php echo $data['common']['send_price']; ?>
                                                </strong>
                                            </li>
                                            <li class="checkout-total-price">
                                                <em><?php echo $this->obj->getValidateMessage('chengjiaozongjia'); ?></em>
                                                <strong class="price"><span><?php echo $this->obj->currency; ?></span><?php echo $data['common']['final_price']; ?>
                                                </strong>
                                            </li>
                                        </ul>
                                    </div>
                                    <div class="clearfix"></div>

                                    <div class="pull-right">
                                        <?php if ($data['isAllowPaymentOrder']) { ?>
                                            <!-- 聚合付款按钮 Start -->
                                            <button class="btn btn-success" type="button"
                                                    id="button-confirm"
                                                    onclick="return payment(<?php echo $data['common']['id']; ?>);">
                                                <?php echo $this->obj->getValidateMessage('pay'); ?>
                                            </button>
                                            <!-- 聚合付款按钮 End -->
                                        <?php } else { ?>
                                            <p><?php echo $data['order_status']['pay_status']; ?></p>
                                        <?php } ?>

                                    </div>

                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- END CONFIRM -->

                </div>
                <!-- END CHECKOUT PAGE -->
            </div>
            <!-- END CONTENT -->
        </div>
        <!-- END SIDEBAR & CONTENT -->
    </div>
</div>

<?php echo $this->obj->view->getPartial('layouts/_footer'); ?>
<!--引入托管 qrcode-->
<script src="/shop/assets/static/js/jquery.qrcode.min.js"></script>

<script>
    /**
     * 聚合支付
     * @param order_id 订单id
     * @returns {boolean}
     */
    function payment(order_id) {
        // 动态添加付款二维码
        let img = '<div id="qrcode"><p><?php echo $this->obj->getValidateMessage('scan-code-to-pay'); ?>：</p><img alt="二维码" src="/pay/createqrcode/' + order_id + '"></div>';
        // 弹出一张二维码图片
        layer.open({
            content: img,
            shadeClose: false,
            btn: "<?php echo $this->obj->getValidateMessage('order-completed'); ?>",
            yes: function () {
                // 如果执行了完成按钮，则刷新页面
                window.location.reload();
            }
        });
    }
</script>
<!-- END PAGE LEVEL JAVASCRIPTS -->
</body>
<!-- END BODY -->
</html>
